const { request } = require("@/utils")

// 1.获取频道列表
export const getChannelAPI = () => {
    return request({
        url:'/channels',
        method:"GET"
    })
}

// 2.新增文章
export const addArticleAPI = (data) => {
    return request({
        url:'/mp/articles?draft=false',
        method:"POST",
        data
    })
}

// 3.获取文章列表
export const getArticleAPI = (params) => {
    return request({
        url:'/mp/articles',
        method:"GET",
        params
    })
}

// 3.删除文章
export const delArticleAPI = (id) => {
    return request({
        url:`/mp/articles/${id}`,
        method:"DELETE"
    })
}

// 4.获取文章详情
export const getArticleId = (id) => {
    return request({
        url:`/mp/articles/${id}`,
        method:"GET"
    })
}

// 5.更新文章
export const updateArticleAPI = (data) => {
    return request({
        url:`/mp/articles/${data.id}?draft=false`,
        method:"PUT",
        data
    })
}
